/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package global.sandbox.xmlutilities.demo;

import global.sandbox.xmlutilities.XMLTools;
import org.w3c.dom.Document;

public class Transformations {
    
    public static Document transform(Document doc, Document xsl)
            throws TransformationsException {
        try {
            return XMLTools.transformToDocument(
                    XMLTools.documentToDOMSource(xsl),
                    XMLTools.documentToDOMSource(doc));
        } catch (Exception ex) {
            throw new TransformationsException(ex);
        }
    }
    
    public static class TransformationsException extends Exception {
        
        private static final long serialVersionUID = 1L;
        
        public TransformationsException(Throwable cause) {
            super(cause);
        }
        
    }
    
}
